<template>
  <div class="div_right_add_friend_search">
    <div class="div_display_inline_block div_right_add_friend_search_input">
      <!--      input.-->
      <input v-model="data.account" class="right_add_friend_search_input" type="text" placeholder="请输入对方账号">
    </div>
    <div class="div_display_inline_block">
      <!--      button.-->
      <el-button @click="search" type="primary">查找</el-button>
    </div>
  </div>
</template>

<script>

import {request} from '../../../util/httprequest'

export default {
  name: "right_add_friend_search",
  data() {
    return {
      data: {
        condition: "",
        account: "",
      },
    }
  },
  methods: {
    search() {
      // 查找.
      if (this.data.account === "") {
        // 提示信息.
        return
      }

      // /api/v1/friend/query
      request("get", "/friend/query?account=" + this.data.account).then((response) => {
        console.log("response")
        console.log(response)
        if (response.data.code === 0) {
          // 正常.
          // 也得用全局状态.
          this.$store.commit('setAddFriendResult', response.data.data)
        } else {
          //  err.
        }
        // 打印下结果.
        console.log(this.$store.state.addfriend.result)
      })
    },
  },
}
</script>

<style scoped>


.div_right_add_friend_search {
  margin-bottom: 50px;
  margin-top: 50px;
}

.div_display_inline_block {
  display: inline-block;
}

.div_right_add_friend_search_input {
  margin-left: 260px;
  border-radius: 10px;
}

.right_add_friend_search_input {
  outline: none;
  background-color: #f7f7f7;
  border-left: 0px;
  border-right: 0px;
  border-top: 0px;
  border-bottom: 0px;
  height: 42px;
  width: 450px;
}

</style>